package com.Cost.service.impl;

import com.Cost.entity.Cost;
import com.Cost.mapper.CostMapper;
import com.Cost.service.CostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CostServiceImpl implements CostService {

    @Autowired
    private CostMapper costMapper; // 假设存在CostMapper

    @Override
    public boolean doAddCostInfo(Cost cost) {
        int result = costMapper.insert(cost);
        return result > 0;
    }

    @Override
    public boolean doModifyCostInfo(Cost cost) {
        int result = costMapper.update(cost);
        return result > 0;
    }

    @Override
    public boolean doDeleteCostInfo(Cost cost) {
        int result = costMapper.delete(cost);
        return result > 0;
    }

    @Override
    public Cost doGetCostInfo(Cost cost) {
        return costMapper.selectOne(cost);
    }

    @Override
    public List<Cost> doGetCostInfoList() {
        return costMapper.selectAll();
    }

    @Override
    public List<Cost> doGetStatisCostInfoList() {
        return costMapper.selectStatisList();
    }

    @Override
    public List<Cost> doQueryCostInfoList(Cost cost) {
        return costMapper.selectByCondition(cost);
    }
}
